//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>

#include "PlotPredictBindingSite.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int main (int argc, char** argv) {
  
  PlotPredictBindingSite* plotPredictBindingSite = NULL;

  if (argc < 4) {
    
    cout << "Error in the input parameters! Must by like: " << endl;
    cout << "./PlotResultPredictionWeightedBindingSitePos <Filename with position of binding site prediction>";
    cout <<                                             " <Header of graph>";
    cout <<                                             " <Folder Out>";
    cout << endl;
    
    return EXIT_FAILURE;
    
  }
  else {
    
    plotPredictBindingSite = new PlotPredictBindingSite ();
    
    plotPredictBindingSite->FilenameIn()->In(argv[1]);
    plotPredictBindingSite->Title()->In(argv[2]);
    plotPredictBindingSite->FolderOut()->In(argv[3]);
    
    cout << "---------------------------------------------------------------------------------" << endl;
    cout << " Filename with position of binding site prediction : " << argv[1] << endl;
    cout << "                                   Header of graph : " << argv[2] << endl;
    cout << "                                        Folder Out : " << argv[3] << endl;
    cout << "---------------------------------------------------------------------------------" << endl;
    
  }
  
  cout << "Loading the input file..." << endl;  
  if (!plotPredictBindingSite->LoadData())
    cout << "Error loading the input file..." << endl;  

  cout << "Building graphs..." << endl;  
  if (!plotPredictBindingSite->PlotWeightedOneByOne())
    cout << "Error building graphs..." << endl;  
  
//  cout << "Building graphs (PS)..." << endl;  
//  if (!plotPredictBindingSite->PlotWeightedOneByOnePS())
//    cout << "Error building graphs..." << endl;  
//
//  cout << "Building combined graphs..." << endl;  
//  if (!plotPredictBindingSite->PlotWeightedAllInOne())
//    cout << "Error building graphs..." << endl;  
//  
//  cout << "Building combined graphs (PS)..." << endl;  
//  if (!plotPredictBindingSite->PlotWeightedAllInOnePS())
//    cout << "Error building graphs..." << endl;  

  cout << "Finished..." << endl << "Good Bye" << endl;
  
  if (plotPredictBindingSite) delete plotPredictBindingSite;
  
  return EXIT_SUCCESS;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//

